package work04graphics;

import java.util.ArrayList;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        ArrayList<Circle> c = new ArrayList<>();
        ArrayList<Rectangle> r = new ArrayList<>();
        ArrayList<Triangular> t = new ArrayList<>();
        while(true) {
            Circle circle = new Circle();
            Rectangle rectangle = new Rectangle();
            Triangular triangular = new Triangular();
            System.out.println("1. 添加圆形 2. 添加矩形 3. 三角形 4. 计算所有面积 5. 退出");
            Scanner scanner = new Scanner(System.in);
            int choice = scanner.nextInt();
            switch(choice) {
                case 1: System.out.println("请输入半径"); circle.setRadius(scanner.nextInt());c.add(circle);break;
                case 2: System.out.println("请输入长和宽"); rectangle.setLo(scanner.nextInt());rectangle.setWi(scanner.nextInt());r.add(rectangle); break;
                case 3: System.out.println("请输入三边长度");triangular.setA(scanner.nextInt());triangular.setB(scanner.nextInt());triangular.setC(scanner.nextInt());t.add(triangular); break;
                case 4://取值
                    for (Circle value : c) {
                        value.getArea();
                    }
                    for (Rectangle value : r) {
                        value.getArea();
                    }
                    for (Triangular value : t) {
                        value.getTriangleArea();
                    }
                    break;
                case 5: return;
            }
        }
    }
}
